//
//  WiKaNavigationView.swift
//  xgwjinterconnection
//
//  Created by WangWeiShuo on 2025/8/18.
//
import SwiftUI

struct WikaNavigationView: View {
    let showBackIcon: Bool
    let title: String
    let onBack: () -> Void
    
    var body: some View {
        ZStack() {
            // 自定义导航栏（确保标题和返回按钮在同一行）
            
            HStack {
                if (showBackIcon){
                    Button(action: onBack) {
                        HStack {
                            Image(systemName: "chevron.backward")
                            Text(NSLocalizedString("back", comment: "返回"))
                        }
                        .foregroundColor(.white)
                    }
                }
                Spacer()
                
            }
            
            Text(title)
                .font(.title3)
                .foregroundColor(.white)
        }
        .padding()
        .background(
            Image("bg_titlebar")
                .resizable()
                .edgesIgnoringSafeArea(.top)
        )
        .frame(maxWidth: .infinity, maxHeight: .infinity)
        .edgesIgnoringSafeArea(.top)
    }
}

#Preview {
    WikaNavigationView(showBackIcon: false,title: "wika", onBack:{})
}
